//#include <base.js>
//#include <openlayersExt.js>
//#include <event.js>


/**
* 
* Factory per creazione di controlli OL
* 
* @namespace CWN2
* @class controlFactory
* 
*/

CWN2.controlFactory = {

	/**
	* 
	* Create an OpenLayers control based on a given configuration
	* 
	* @method createControl
	* 
	* @param {controlConfig} controlConfig Obj containing the control configuration 
	* 
	* @return: 	{OpenLayers.Control}
	* 
	*/ 
	
	createControl: function(controlConfig) {

		if (CWN2.base.DEBUG) {
			console.log('CWN2.controlFactory.createControl');
		}
		try {
			return new OpenLayers.Control[controlConfig.name](controlConfig.options);
		}
		catch (exception) {
			throw('CWN2.controlFactory.createControl: OpenLayers.Control.' + controlConfig.type + ' non implementato');
			return null;			
		}
		
	}
	
};
